#include <SplashState.hpp>
#include <GameEngine.hpp>

namespace EE
{
	SplashState::SplashState(GameEngine *engine) :
		GameStateBase(engine)
	{
		splashscreen = new sf::Sprite;
		splashscreen->SetTexture(GameEngine::textureManager.Load("art/Splash.jpg"));
		waitTime = 0;
	}

	void SplashState::Process(sf::Event event)
	{
		switch (event.Type)
		{
			case sf::Event::Closed:
				game->Stop();
				break;
			default:
				break;
		}
	}

	void SplashState::Update()
	{
	}

	void SplashState::UpdateTimed(unsigned long time)
	{
		waitTime += time;
		if (waitTime > timeToWait)
		{
			game->StopState();
		}
	}

	void SplashState::Render()
	{
		game->window->Draw(*splashscreen);
	}
}
